package 链接snappydate数据库相关操作.snappydateDDL相关操作

import org.apache.log4j.Logger

import java.sql.DriverManager

class Create_Cursor {
  val url: String = s"jdbc:snappydata://172.16.193.60:1527/"
  val conn = DriverManager.getConnection(url)
  val log:Logger=Logger.getLogger("Structure_change_ of_detection_table1.0")
  if(conn==null)
  {
    log.error("The database is not connect:\n"+conn)
  }
  def create_table(): Unit = {
    //Create table structure
    //    val url: String = s"jdbc:snappydata://172.16.136.26:1527/"
    //    val conn1 = DriverManager.getConnection(url)

    val stmt1 = conn.createStatement()
    // Creating a table (PARTSUPP) using JDBC connection
    //drop table
    stmt1.execute("DROP TABLE IF EXISTS ops_monitor.audit_struct_table")
    log.info("Database drop successfully ops_monitor.audit_struct_table")
    println("Database drop successfully")
    //create table
    stmt1.execute("CREATE TABLE ops_monitor.audit_struct_table ( " +
      "schemaname     VARCHAR NOT NULL," +
      "lastuptime     timestamp NOT NULL," +
      "objectname     VARCHAR NOT NULL"+")")
    log.info("create table  ops_monitor.audit_struct_table")

  }

}
object Create_Cursor{

}

